/*
Date:20210510 15:30PM
key:构建双向至今乘数组，最后新数组d[i]=b[i-1]*c[i+1]。
*/
class Solution {
public:
    vector<int> constructArr(vector<int>& a) 
    {
        vector<int>b;
        b.resize(a.size());
        vector<int>c;
        c.resize(a.size());
        int re=1;
        int co=0;
        int p0;
        for(int i=0;i<a.size();i++)
        {
            if(i==0){
                b[i]=a[i];
            }
            else
            {
                b[i]=a[i]*b[i-1];
            }
            
        }
                for(int i=a.size()-1;i>-1;i--)
        {
            if(i==a.size()-1)
            {
                c[i]=a[i];
            }
            else
            {
                c[i]=a[i]*c[i+1];
            }
            
        }
        vector<int>d;
        d.resize(a.size());
        
        for(int i=0;i<a.size();i++)
        {
            if(i==0)
            {
                d[i]=c[1];
                continue;
            }
            if(i==a.size()-1)
            {
                d[i]=b[a.size()-2];
                continue;
            }
            else
            {
                d[i]=b[i-1]*c[i+1];
            }
        }
        return d;
    }
};